package com.dvt.faceScan;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.dvt.faceScan.R;

public class SexChoiseActivity extends Activity {
    public RadioGroup mRadioGroup1;
    public RadioButton mRadio1, mRadio2;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sexchoise);
        setTitle("性别选择");
        initView();
        mRadioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                String sex = "";
                if (checkedId == mRadio1.getId()) {
                    sex = "男";
                } else if (checkedId == mRadio2.getId()) {
                    sex = "女";
                }
                Intent intent = new Intent();
                intent.putExtra("sex", sex);
                setResult(Activity.RESULT_OK, intent);
                finish();
            }
        });
    }


    private void initView() {
        mRadioGroup1 = (RadioGroup) findViewById(R.id.gendergroup);
        mRadio1 = (RadioButton) findViewById(R.id.boy);
        mRadio2 = (RadioButton) findViewById(R.id.girl);
    }

}




